import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:school_safe_teacher/resourse/app_colors.dart';
import 'package:school_safe_teacher/widget/my_widget.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    TruancysubmissionState state, Dispatch dispatch, ViewService viewService) {
  return body(
      child: Container(
        color: AppColors.MainBackColor,

        child: Column(
          children: [
            Container(
              child: myBar(context: viewService.context, title: "作业记录"),
              color: Colors.white,
            ),
            Container(
              margin: EdgeInsets.only(top: 1),
              height: 40,
              padding: EdgeInsets.only(top: 0,bottom: 0,left: 15,right: 15),
              color: Colors.white,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text("班级",
                      style: TextStyle(
                        color: AppColors.deepTextColor,
                        fontSize: 15,
                      )),
                  Text("三年级二班",
                      style: TextStyle(
                        color: AppColors.deepTextColor,
                        fontSize: 15,
                      )),
                ],
              ),
            ),
            Container(
              color: Colors.white,
              height: 40,
              margin: EdgeInsets.only(top: 1),
              padding: EdgeInsets.only(top: 0,bottom: 0,left: 15,right: 15),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text("学生",
                      style: TextStyle(
                        color: AppColors.deepTextColor,
                        fontSize: 15,
                      )),
                  Expanded(child: TextField(

                    onChanged: (value) {
                      //state..code = value;
                      // dispatch(LoginActionCreator.onInputCode());
                    },
                    decoration: InputDecoration(

                        border: InputBorder.none,
                        hintText: "请输入学生姓名",
                        isDense: true,
                        hintStyle: TextStyle(
                            fontWeight: FontWeight.normal,
                            fontSize: 14,
                            color: AppColors.hintTextColor)),
                    textAlign: TextAlign.right,
                    textAlignVertical: TextAlignVertical.center,
                  ))
                ],
              ),
            ),
            GestureDetector(
              child: Container(
                height: 45,
                margin: EdgeInsets.fromLTRB(25, 33, 25, 0),
                alignment: Alignment.center,
                width: MediaQuery.of(viewService.context).size.width - 50,
                child: Text(
                  "提交",
                  style: TextStyle(
                      color: Colors.white,
                      fontSize: 15,
                      fontWeight: FontWeight.normal),
                ),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(25),
                  color: AppColors.editBackgroundColor,
                  gradient: LinearGradient(
                    begin: Alignment.centerLeft,
                    end: Alignment.centerRight,
                    colors: [
                      AppColors.loginLeft,
                      AppColors.loginRight,
                    ],
                  ),
                ),
              ),
              onTap: () {
                dispatch(TruancysubmissionActionCreator.onupdateData(state.textValue));
              },
            ),

          ],
        ),
      ),
      context: viewService.context);
}
